package icu.xuyijie.springbootlearning2.chapter3.mybatis;

import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author 徐一杰
 * @date 2025/02/25 13:56
 * @description
 */
@Mapper
public interface MyEntityMapper {

    MyEntity getMyEntityById(Integer id);

    @Select("SELECT * FROM test")
    List<MyEntity> findAll();

    @Insert("INSERT INTO test (name, create_time) VALUES (#{name}, #{createTime})")
    int insert(MyEntity entity);

    @Update("UPDATE test SET name = #{name} WHERE id = #{id}")
    int update(String name, Integer id);

    @Delete("DELETE FROM test WHERE id = #{id}")
    int delete(int id);
}
